const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');

const server = express();
// 中间件
server.use(express.static('../../wanbaionet'))
server.use(cors())
server.use(bodyParser.urlencoded({ extended: false }))
server.use(bodyParser.json());

server.all('*', (request, response, next) => {
    response.setHeader('Content-Type', 'application/json;charset=utf-8');
    next();
})
server.use('/api', require('./router/apiRouter').apiRouters)

server.listen(8080, () => {
    console.log('api服务器启动完毕');
})